DISTDIR = dist
PACKAGE = gaileenchess
EXEC = gaileenchess.jar
MAIN = ${PACKAGE}.Main

build:
	javac -d . *.java

buildtests:
	javac -d . tests/*.java

run:
	java ${MAIN}

runtests:
	tests/test

rundist:
	java -jar ${DISTDIR}/${EXEC}

clean:
	rm -rf ${PACKAGE}

cleandist:
	rm -rf ${DISTDIR}

dist: cleandist
	mkdir dist
	echo "Main-Class: ${MAIN}" > ${DISTDIR}/Manifest.txt
	jar cfm ${DISTDIR}/${EXEC} ${DISTDIR}/Manifest.txt ${PACKAGE}/*.class
	rm ${DISTDIR}/Manifest.txt

all: cleanbuildall runtests dist
cleanbuild: clean build
cleanall: clean cleandist
buildall: build buildtests
cleanbuildall: cleanbuild buildtests
